#include<iostream>
#include<cstdlib>
#include<ctime>
#include<cmath>
using namespace std;
int commonDivisor(int x1,int x2) {
	//int m = 0;
	for (int i = x1; i >= 1; i--) {
		if (x1 % i == 0 && x2 % i == 0) {
		//	m = 1;
			return i;
		}
		//if (m == 1)break;
	}
}
int commonDivisor(int x1, int x2, int x3) {
	for (int i = x1; i >= 1; i--) {
		if (x1 % i == 0 && x2 % i == 0 && x3 % i == 0) {
			return i;
		}
	}
}
int commonDivisor(int x1, int x2, int x3,int x4) {
	for (int i = x1; i >= 1; i--) {
		if (x1 % i == 0 && x2 % i == 0 && x3 % i == 0&&x4%i==0) {
			return i;
		}
	}
}
int main() {
	int n;   //n个整数； 
	cout << "整数的个数为：";
	cin >> n;
	cout << "请输入";
	cout << n;
	cout<< "个整数：";
	int a[10];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	if (n == 2) {
		int m = commonDivisor(a[0], a[1]);
		cout << "整数";
		for (int i = 0; i < n; i++)cout << a[i] << ' ';
		cout << "的最大公约数为：";
		cout << m;
	}
	if (n == 3) {
		int m = commonDivisor(a[0], a[1], a[2]);
		cout << "整数";
		for (int i = 0; i < n; i++)cout << a[i] << ' ';
		cout << "的最大公约数为：";
		cout << m;
	}
	if (n == 4) {
		int m = commonDivisor(a[0], a[1], a[2], a[3]);
		cout << "整数";
		for (int i = 0; i < n; i++)cout << a[i] << ' ';
		cout << "的最大公约数为：";
		cout << m;
	}
	return 0;
}